package com.pwl.gs.controller;

import com.pwl.gs.entity.SUser;
import com.pwl.gs.service.SUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(path = "/user")
public class UserController {

    @Autowired
    private SUserService userService;

    @GetMapping(path = "/index")
    public String index(){
        return "user/index";
    }

    @PostMapping (path = "/list")
    @ResponseBody
    public List<SUser> List(){
        return userService.findAll();
    }
}
